{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}{{ asset_type }}导入{% endblock %}
{% block content %}
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        {{ asset_type }}导入<small>导入数据表格，请注意模板</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href={% url 'dashboard' %}><i class="fa fa-dashboard"></i> 主页</a></li>
        <li>{{ asset_type }}管理</li>
        <li class="active">{{ asset_type }}导入</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">

      <!-- Default box -->
      <div class="box">
        <div class="box-header with-border">
        </div>
        <div class="box-body">
          <p>请下载{{ asset_type }}导入模版</p>
          <a href="{% url 'file_download' asset_type %}">下载</a>
          <br>
          <br>
          <p>请上传{{ asset_type }}列表文件</p>
            <form id='form1' method="post" onsubmit="return checkForm()" enctype="multipart/form-data" >
               {% csrf_token %}
               <input type="file" id='file' name="excel">
               <br>
               <button type="submit">上传</button>
            </form>
        </div>
        <div class="box-footer">
            <i class="fa fa-angle-double-left"></i>&nbsp;&nbsp;<a href="{% url 'index' %}"><strong>返回资产列表页</strong></a>
        </div>
        <!-- /.box-footer-->
      </div>
      <!-- /.box -->

    </section>
    <!-- /.content -->

<script type="text/javascript"> 
       function checkForm(){ 
            var file = document.getElementById('file'); 
            if (file.value == "") { 
               alert("请选择您需要上传的文件！"); 
               return false;
            }
            else{ 
               var form = document.getElementById('form1');
               return true; 
            } 
       } 
</script> 
{% endblock %}
